<?php

# 'menu' table représentant un menu (ensemble de liens) du site (header, footer, ...)"
class Menu extends Model {
	
    var $id = null;
	var $key = '';
	var $name = '';
	
    function Menu()
    {
        parent::Model();
    }
	
	function get_by_id($id)
	{
		$this->db->select('id, key, name')
		         ->from('menu')
				 ->where('id', $id);
		$query = $this->db->get();
		return $query->row();
	}
	
	/**
	 * Retrieve all menus
	 */
	function all()
    {
		$this->db->select('id, key, name')
		         ->from('menu')
				 ->order_by('name');
		
		$query = $this->db->get();
		return $query->result();
	}
}
